import operate from '@dfeidao/atom-nodejs/db/operate';
import { IncomingHttpHeaders } from 'http';
import { productid, systemid } from '../../atom/config';
interface Message {
	filter: {
		risk_no: string
		project_no: string
		risk_status: number
		risk_type: number
		involved_amount: number
		risk_content: string
		memo: string
	};
	// cookie: {
	// 	uk: string;
	// 	[key: string]: string
	// };
	// urls: {
	// 	base: string;
	// 	origin: string;
	// 	url: string;
	// };
	// query: {};
	// params: {};
	// headers: {};
	// captcha: string;
}



export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const op = operate(action_id, session_id, systemid);
	op.update('risk_management', { productid, risk_no: message.filter.risk_no }, {
		risk_status: message.filter.risk_status,
		risk_type: message.filter.risk_type, involved_amount: message.filter.involved_amount, risk_content: message.filter.risk_content,
		memo: message.filter.memo
	});
	return await op.exec();
}
